package com.pda.gongpin.ui.shipments;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.pda.gongpin.R;
import com.pda.gongpin.adapter.MyTitleViewPagerAdapter;
import com.wangshen.base.app.AppActivityKey;
import com.wangshen.base.ui.mvp.base.ui.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

@Route(path = AppActivityKey.SHIPMENTSACTIVITY)
public class ShipmentsTabActivity extends BaseActivity {
    @BindView(R.id.iv_close)
    ImageView ivClose;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_back)
    TextView tvBack;
    @BindView(R.id.smart)
    SmartTabLayout smart;
    @BindView(R.id.vp_content)
    ViewPager vpContent;
    private List<Fragment> fragments = new ArrayList<>();
    private List<String> titleList = new ArrayList<>();
    private MyTitleViewPagerAdapter myTitleViewPagerAdapter;

    @Override
    public int getView() {
        return R.layout.activity_tab;
    }

    @Override
    public void initView() {

        tvTitle.setText("发货");
        myTitleViewPagerAdapter = new MyTitleViewPagerAdapter(getSupportFragmentManager(), fragments, titleList);
        vpContent.setAdapter(myTitleViewPagerAdapter);
        vpContent.setOffscreenPageLimit(2);
        smart.setViewPager(vpContent);
    }

    @Override
    public void initLinsenterner() {

    }

    @Override
    public void getData() {
        String deliveryNo = getIntent().getExtras().getString("deliveryNo");
        String state=getIntent().getExtras().getString("state");
        String originOrderNum=getIntent().getExtras().getString("originOrderNum");
        fragments.add(new ShipmentsFragment(deliveryNo,state,originOrderNum));
        fragments.add(new ShipmentsStaticsFragment(deliveryNo,originOrderNum));
        titleList.add("发货");
        titleList.add("统计");
        //titleList.add("明细");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.iv_close)
    public void onViewClicked() {
        finish();
    }
}
